//
//  NetRequest+ToolAPI.m
//  AppleMarket
//
//  Created by yangy on 24/10/2018.
//  Copyright © 2018 szgsy. All rights reserved.
//

#import "NetRequest+ToolAPI.h"

@implementation NetRequest (ToolAPI)

+ (void) request_imageCodeWithType:(NSString*) type
                   completeHandler:(void (^)(id responseObj)) completeHandler
                              fail:(void (^)(NSError *error)) failHandler
{
    [self getWithUrl:@"/api/ToolkitApi/GetImageCode" parameters:@{@"type":type} success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO];
}

+ (void) request_SendMsgCodeType:(NSString*) type
                         account:(NSString*) account
                            code:(NSString*) code
                             key:(NSString*) key
                 completeHandler:(void (^)(id responseObj)) completeHandler
                            fail:(void (^)(NSError *error)) failHandler
{
    NSDictionary *parameters = @{
                                 @"Account" : account,
                                 @"AreaCode" : @(86),
                                 @"ImgCode" : code,
                                 @"ImageCodeType" : type,
                                 @"ImageCodeKey" : key
                                 };
    [self postWithUrl:@"/api/ToolkitApi/SendMsgCode" parameters:parameters success:^(id response) {
        completeHandler(response);
    } fail:^(NSError *error) {
        failHandler(error);
    } showHUD:NO includeParameterToURL:NO];
}

@end
